<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/4/16
  Time: 21:07
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑新闻</title>
    <link href="/static/css/bootstrap.min.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/admin.css">
</head>
<style>
    .ke-container.ke-container-default{
        width:450px!important;
        margin-left: 40px;
        margin-top: 5px;
    }
</style>
<body>
<div style="padding: 15px;">
    <form class="bs-example bs-example-form" role="form" method="post" onsubmit="return ValidForm(this)">
        <table class="table">
            <tr>
                <td min-width="90">新闻标题</td>
                <td><input type="text" class="form-control" name="title" placeholder="请输入新闻标题" value=""></td>
            </tr>
            <tr>
                <td>新闻内容</td>
                <td><input type="text" class="form-control" id="content" name='content' placeholder="请输入新闻内容" value=""></td>
            </tr>
            <tr>
                <td>原文地址</td>
                <td><input type="text" class="form-control" name="url" placeholder="请输入原文地址" value=""></td>
            </tr>
            <tr>
                <td>发布时间</td>
                <td><input type="text" class="form-control stime" name='stime' readonly placeholder="请选择发布时间" value=""></td>
                <td><input type="hidden" name='id' value=''></td>
            </tr>
        </table>
        <button class="btn btn-primary btn-lg btn-block" type='submit'>提交保存</button>
    </form>
</div>
</body>
<script src="/static/js/jquery.min.js"></script>
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
<script src="/static/layer/layer.js"></script>
<!--副文本编辑器-->
<script charset="utf-8" src="/static/kindeditor/kindeditor-all.js"></script>
<script charset="utf-8" src="/static/kindeditor/lang/zh-CN.js"></script>
<script>
    $(function(){
        KindEditor.ready(function(K) {
            window.content = K.create('#content', {
                resizeType : 1,
                allowPreviewEmoticons : false,
                allowImageUpload : false,
                height : '300px',
                items : [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat','|','multiimage','|','quickformat','lineheight','justifyleft','justifycenter','justifyrigh','justifyfull','fullscreen']
            });
        });
    });

    function Contentfn(content) {
        KindEditor.html("#content",content);
    }

    $(".stime").datetimepicker({format: 'yyyy-mm-dd',minView:2,autoclose:true,language: 'zh-CN',});
    function ValidForm(){
        var title=$('input[name=title]').val(),
            stime=$('input[name=stime]').val();
        if(!title){
            $('input[name=title]').focus();
            layer.msg('请输入新闻标题',{icon: 2,time:1000});
            return false;
        }
        if(!stime){
            $('input[name=stime]').focus();
            layer.msg('请选择发布时间',{icon: 2,time:1000});
            return false;
        }
    }
</script>
</html>
